﻿using System;
using DDotNet.ORM.ORMapping.Attribute;
using DDotNet.ORM.ORMapping.Attribute.DirectAccess;
using DDotNet.ORM.ORMapping.OREntity;

namespace GenericTests.Entities
{
    /// <summary>
    /// 
    /// </summary>
    [Serializable()]
        [DBMapping("MainDB")]
    [DirectEntityMapping("tb_ShopItem", AllowDelete = true, AllowInsert = true, AllowUpdate = true)]
    public sealed class ShopItem : BusinessEntityBase
    {
        #region Construtor

        public ShopItem()
        {
        }

        #endregion

        private int _ID;

        private int _IDShop;

        private string _ProductName;

        private double _Value;

        /// <summary>
        ///
        /// </summary>
        [PropertyMapping("Value")]
        public double Value
        {
            get { return this._Value; }
            set
            {
                this._Value = value;
                base.MarkDirty("Value");
            }
        }

        /// <summary>
        ///
        /// </summary>
        [PropertyMapping("ProductName")]
        public string ProductName
        {
            get { return this._ProductName; }
            set
            {
                this._ProductName = value;
                base.MarkDirty("ProductName");
            }
        }

        /// <summary>
        ///
        /// </summary>
        [EntityForeignKey("ID")]
        [PropertyMapping("IDShop")]
        public int IDShop
        {
            get { return this._IDShop; }
            set
            {
                this._IDShop = value;
                base.MarkDirty("IDShop");
            }
        }

        /// <summary>
        /// 
        /// </summary>
        [EntityPrimaryKey(true)]
        [PropertyMapping("IDShopItem")]
        public int ID
        {
            get { return this._ID; }
            set
            {
                this._ID = value;
                base.MarkDirty("ID");
            }
        }
    }
}